import org.junit.Test;
import redis.clients.jedis.Jedis;

public class TestJedis {

    @Test
    public void testConn() {
        //与Redis建立连接 IP+port
        Jedis jedis = new Jedis("192.168.241.129", 6379);
        //在Redis中写字符串 key value
        jedis.set("jedis:name:1", "jd-zhangfei");
        //获得Redis中字符串的值
        System.out.println(jedis.get("jedis:name:1"));
        // 在Redis中写list
        jedis.lpush("jedis:list:1", "1", "2", "3", "4", "5");
        // 获得list的长度
        System.out.println(jedis.llen("jedis:list:1"));
    }

}
